/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package calcmvc;

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

/**
 *
 * @author Administrator
 */
public class CalcViewer extends JFrame{
    
    private CalcController controller;
    private CalcJPanelWithNumberButtons JPanelWithNumberButtons;
    private Container containerPane;
    private JTextArea textField;
    
    public CalcViewer(CalcController con)
    {
        //object creation
        controller = con;
        JPanelWithNumberButtons = new CalcJPanelWithNumberButtons(
                                        controller, this);
        containerPane = getContentPane();
        textField = new JTextArea(3, 1);
        
        
        //variable and state change
          //textField change
         textField.setWrapStyleWord(true);
         textField.setEditable(false);
         textField.setLineWrap(true);
         textField.setPreferredSize(new Dimension(265, 100));
        
        setTitle("Advanced Calculator 0.1");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setPreferredSize(new Dimension(265,450));
        
        //
        addContent();
        
        
        //packing and showing
        pack();
        setVisible(true);
        
    }
    
    private void addContent()
    {
        containerPane.add(JPanelWithNumberButtons, BorderLayout.CENTER);
        containerPane.add(textField, BorderLayout.NORTH);
        //containerPane.add(new JLabel("Debug2"));
    }
    
    private void createButtons()
    {
        
    }
    
    private void createButtonLayout()
    {
        
    }
    
    private void createLayout()
    {
        
    }
    
    public JTextArea getTextArea()
    {
        return textField;
    }
    
    public CalcJPanelWithNumberButtons getButtonPanel()
    {
        return JPanelWithNumberButtons; 
    }
    
    public void addStringToTextArea(String s)
    {
        textField.append(s);
    }
    
    

}
